<?php
/**
 * Created by Benjiemin
 * Date: 2020/2/26
 * Time: 16:45
 */
require ('./vendor/autoload.php');
require ('./aip-php-sdk-2.2.15\AipOcr.php');

use QL\QueryList;
use QL\Ext\Chrome;

$ql = QueryList::getInstance();
// 注册插件，默认注册的方法名为: chrome
$ql->use(Chrome::class);
$text = $ql->chrome(function ($page,$browser) {
    $username = 'jian7756082@qq.com';
    $password = 'fuck382259592';
    $page->goto('https://weibo.com');
    sleep(10);
    //点击登录
    $page->click("input[node-type='loginBtn']");
    // 这里故意设置一个很长的延长时间，让你可以看到chrome浏览器的启动
    $page->type("input #loginname",$username);
    $page->type("input[name='password']",$password);
    $page->click("input[type='submitBtn']");
    sleep(3);
    //登录
    $html = $page->content();
    sleep(10);

    $browser->close();
    sleep(5);
    // 返回值一定要是页面的HTML内容
    return $html;
},[
    'headless' => false, // 启动可视化Chrome浏览器,方便调试
    'devtools' => false, // 打开浏览器的开发者工具
])->find('title')->text();
